package cc.rengu.redp.bizimpl.csmc.service.impl;

import cc.rengu.redp.bizimpl.csmc.domain.CMchntRiskFundInfo;
import cc.rengu.redp.bizimpl.csmc.dao.CMchntRiskFundInfoMapper;
import cc.rengu.redp.bizimpl.csmc.service.ICMchntRiskFundInfoService;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lizk
 */
@Service
@DS("csmc")
public class CMchntRiskFundInfoServiceImpl extends ServiceImpl<CMchntRiskFundInfoMapper, CMchntRiskFundInfo> implements ICMchntRiskFundInfoService {

    @Override
    public String getRealNetAmt(String mchntNo) {
        LambdaQueryWrapper<CMchntRiskFundInfo> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(CMchntRiskFundInfo::getMchntNo, mchntNo);

        List<CMchntRiskFundInfo> list = baseMapper.selectList(queryWrapper);
        if (list.size() == 0) {
            return "0.00";
        } else {
            return list.get(0).getMchntRealNetAmt();
        }
    }
}
